<script setup lang="ts">
import { watch, ref } from "vue";
var count = ref(0);
function increment() {
  console.log(count.value);
  count.value++;
}
watch(count, (newValue, oldValue) => {
  console.log(`count 变化了,从${oldValue}变成了${newValue}`);
});
</script>

<template>
  <div>
    <h1>当前计数: {{ count }}</h1>
    <button @click="increment">增加</button>
  </div>
</template>
